package inheritancedemo;

class Animal{
    public String name;
    public int age;
    public String sex;

    public void eat(){
        System.out.println(this.name + "eat()");
    }

    public void sleep(){
        System.out.println(this.name + "sleep()");
    }
}

/**
 * 继承
 */
class Cat extends Animal{
    public void mew(){
        System.out.println(this.name + "cat::mew");
    }
}

class Dog extends Animal{
    public void bark(){
        System.out.println("dog::旺旺");
    }
}

public class TestDemo {
    public static void main(String[] args) {
        Cat cat = new Cat();
        cat.name = "咪咪";
        cat.sleep();
        cat.eat();
        cat.mew();
    }
}
